package com.itcam.controller;

import com.itcam.common.Result;
import com.itcam.pojo.vo.PortalVo;
import com.itcam.service.HeadlineService;
import com.itcam.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Author:Cammy.Wu
 * Date:2024-05-13
 * Description:首页的控制层
 */

@RestController
@RequestMapping("portal")
@CrossOrigin
public class PortalController {
    @Autowired
    private TypeService typeService;

    private HeadlineService headlineService;

    @GetMapping("findAllTypes")
    public Result findAllTypes() {
        Result result = typeService.findAllTypes();
        return result;
    }

    @PostMapping("findNewsPage")
    public Result findNewsPage(@RequestBody PortalVo portalVo) {
        Result result = headlineService.findNewsPage(portalVo);
        return result;
    }

    @PostMapping("showHeadlineDetail")
    public Result showHeadlinewDetail(Integer hid) {
        Result result = headlineService.showHeadlineDetail(hid);

        return result;
    }
}
